<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <!-- 值传递
  地址传递//引用传递 -->
  <script>
    // function cal(a,b){
    //   t=a;a=b;b=t;
    //   console.log("a="+a+",b="+b);
    // }
    // var x=12,y=34;
    // cal(x,y);
    // console.log("x="+x+",y="+y);
    // var str = new String();
    // var date = new Date();
    function Person(name,age){
      this.name  = name;
      this.age = age;
      this.sayHello = function(){
      }
    }
    Person.prototype.introduce = function(){

    }
    
    var p1 = new Person("张三",12);
    var p2 = new Person("李四",34);
    console.log(p1.sayHello == p2.sayHello);
    console.log(p1.introduce == p2.introduce);

    Person.prototype = {
      study: function(){
        
      }
    }

    var newObj = Object.create(Person);
    newObj.study();
    newObj.prototype.work= function(){
      
    }
    
    
  </script>
</body>
</html>